package com.scfire.fund

import org.grails.databinding.BindingFormat

import com.scfire.project.Donate
import com.scfire.project.Project
import com.scfire.security.Member

/**
 * Copyright 2015 Shudao Info Tech Co. Ltd.  All rights reserved.
 * @author lhzeng
 * @email zenglh@haoshudao.com
 * @date 2016年3月7日 下午4:58:23
 * @version V1.3
 * 
 * 资金池配捐记录
 */
class FDonate implements Comparable  {
	
	//配捐金额
	int donate_fee
	
	//配捐人
	//Member member
	
	//配捐支付状态（未支付 false 、已支付true）
	boolean status = false
	
	//配捐时间
	@BindingFormat('yyyy-MM-dd HH:mm')
	Date date
	
	int fundPool
	
	int project
	
	int member
	
	int donate
	 
	//配捐归属资金池/项目/捐赠人/捐赠记录
	//static belongsTo = [fundPool:FundPool,project:Project,member:Member,donate:Donate]

    static constraints = {
		donate_fee nullable:false
		status nullable:false
		date nullable:true
		
		fundPool nullable:true
		project nullable:true
		member nullable:true
		donate nullable:true
    }
	
	public int compareTo(Object o) {
		try{
			-date.compareTo(o?.date)
		}catch(Exception e){
			return 1
		}
	}
}
